const adminRouter = require('./routes/admin/index')
const clientRouter = require('./routes/client/index')
const cors = require('cors')
const express = require('express')
const app = express()

app.use('/public/', express.static('./public/'))
app.engine('html', require('express-art-template'))
app.use(express.urlencoded({
    extended: false
}))
app.use(express.json())
app.use(cors())

// 路由配置一定要放在最后
// /admin/api 指定了后台管理端的API前缀
app.use('/admin/api', adminRouter)
// client/api 指定页面端的API前缀
app.use('/client/api', clientRouter)


app.listen(3000, () => {
    console.log("✅server listening on port 3000✅")
})